//
//  Video.swift
//  YiYaoHui
//
//  Created by 高永效 on 15/12/6.
//  Copyright © 2015年 TMPercy. All rights reserved.
//

import Foundation

//{
//    "result": "success",
//    "Videos":[
//    {
//    "enterpriseName": "石药集团有限公司",
//    "id": 12,
//    "name": "张廷模中药学网络视频同步讲稿",
//    "pageUrl": "http://www.yaoq.net/thread-26347-1-2.html",
//    "speaker": "张廷模",
//    "subject":{
//    "id": 51,
//    "name": "中医骨伤科",
//    "parent_id": 43,
//    "parent_name": "中医科"
//    }
//    }
//    ]
//}

struct Subject {
    var id = ""
    var name = ""
    var parent_id = ""
    var parent_name = ""
    
    init(subject: Dictionary<String, AnyObject>) {
        self.id = subject["id"]!.description
        self.name = subject["name"] as! String
        self.parent_id = subject["parent_id"]!.description
        self.parent_name = subject["parent_name"] as! String
    }
}

class Video {
    
    var enterpriseName = ""
    var id = ""
    var videoName = ""
    var videoURL = ""
    var speaker = ""
    var subject: Subject!
    
    init(video: Dictionary<String, AnyObject>) {
        enterpriseName = video["enterpriseName"] as! String
        id = video["id"]!.description
        videoName = video["name"] as! String
        videoURL = video["pageUrl"] as! String
        speaker = video["speaker"] as! String
        subject = Subject(subject: video["subject"] as! Dictionary<String, AnyObject>)
    }
}